﻿#ifndef _LISTENSOCKET_H
#define _LISTENSOCKET_H

#include <list>
#include <map>
#include "socketfd.h"

using namespace std;

namespace SocketLib
{

class SocketFDPoll;

class ListenSocket : public SocketFD
{
public:
    ListenSocket();
    bool                listen(int aPort, int aBacknum);
    void                setPoll(SocketFDPoll* pPoll);
    void                disSocketFD(SocketFD*    pSocketFD);

    void                addFreeSocketFD(SocketFD* pSocketFD);
protected:
    bool                onRead();
    SocketFD*           getFreeSocketFD();

private:
    SocketFDPoll*       m_poll;
    list<SocketFD*>     m_freeList;
};

}

#endif
